from flask import Flask,render_template, request
import dbo
import json
app = Flask(__name__)

@app.route('/')
def hello_world():
   return render_template('index.html')

@app.route('/show-rules')
def show_rules():
    return dbo.get_rules_detail()

@app.route('/get-feature')
def get_feature():
    return dbo.get_feature("")

@app.route('/add-rule', methods=['POST'])
def add_rule():
    data = request.get_data()
    json_data = json.loads(data.decode('utf-8'))
    dbo.add_rules(json_data.get('feature_names'),json_data.get('conclusionn'),json_data.get('is_temp'))
    return {'status':'ok'}



if __name__ == '__main__':
   app.run()